package com.yyx.app1.Question_function.Control.petinfo;

import android.app.Activity;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.yyx.app1.Data.BaseDataManager;
import com.yyx.app1.Data.testDate;
import com.yyx.app1.MyApp;
import com.yyx.app1.R;
import com.yyx.app1.tool.ImageTool;

import org.androidannotations.annotations.AfterViews;
import org.androidannotations.annotations.EViewGroup;
import org.androidannotations.annotations.ViewById;

/**
 * Created by yuexing on 2015/10/22.
 */
@EViewGroup(R.layout.item_petinfo_immunization)
public class Item_PetInfo_immunization extends LinearLayout {
    private Context context;
    @ViewById
    ImageView ico;

    @ViewById
    TextView immunization_time,immunization_jilu;

    public Item_PetInfo_immunization(Context context) {
        super(context);
        this.context = context;
    }

    public Item_PetInfo_immunization(Context context, AttributeSet attrs) {
        super(context, attrs);
        this.context = context;
    }

    public Item_PetInfo_immunization(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        this.context = context;
    }

    public void bind(int position,String time ,String yimiao)
    {
        ico.setImageBitmap(BaseDataManager.getMyBaseDataManager(context).getResDrawable( testDate.res[position%testDate.res.length], ImageTool.dip2px(context, 18), ImageTool.dip2px(context, 18)));
        ico.setBackgroundResource(testDate.yuanjiao[position%testDate.yuanjiao.length]);
        immunization_time.setText(time);
        immunization_jilu.setText(yimiao);
    }
}
